#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

void mapping(const char *str, map<char, vector<char> > &myMap, vector<string> &ans,
string &cur)
{
    if (*str == '\0') {
        ans.push_back(cur);
        cout << cur << endl;
        return;
    }
        if (myMap.count(*str) == 0) {
            cur += *str;
            mapping(str+1, myMap, ans, cur);
            cur.erase(cur.begin() + cur.size()-1); 
        } else {
            vector<char> &m = myMap[*str];
            for (int i = 0; i < m.size(); i++) {
                cur += m[i];
                mapping(str+1, myMap, ans, cur);
                cur.erase(cur.begin() + cur.size()-1); 
            }
        }
}

int main(int argc, char **argv)
{
    map<char, vector<char> > myMap;
    vector<char> vec;
    vec.push_back('@');
    vec.push_back('4');
    vec.push_back('A');
    myMap['a'] = vec;
    vector<string> ans;
    string cur;
    mapping("face", myMap, ans, cur);
    for (int i = 0; i < ans.size(); i++)
        cout << ans[i] << endl;
    cout << "-----------------Test 1--------------------" << endl;


    cout << "-----------------Test 2--------------------" << endl;


    cout << "-----------------Test 3--------------------" << endl;


    cout << "-----------------Test 4--------------------" << endl;


    cout << "-----------------Test 5--------------------" << endl;



}
